package yygh.order.receiver;

import com.rabbitmq.client.Channel;
import yygh.hospital.vo.msm.MsmVo;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import yygh.order.Service.OrderService;
import yygh.rabbitmq.constant.MqConst;

/**
 *  mq相关监听器，类似于Controller的作用
 */
@Component
public class OrderReceiver {


        @Autowired
        private OrderService orderService;

        @RabbitListener(bindings = @QueueBinding(
                value = @Queue(value = MqConst.QUEUE_MSM_ITEM, durable = "true"),
                exchange = @Exchange(value = MqConst.EXCHANGE_DIRECT_MSM),
                key = {MqConst.ROUTING_MSM_ITEM}
        ))
        public void send(MsmVo msmVo, Message message, Channel channel) {
           orderService.patientTip();
        }
    }

